<?php
//----------------------------------------------------
//Javascript側から送られたデータを使用可能にする
//----------------------------------------------------
$data = array();

$db_table    = htmlspecialchars($_GET['db_table'],    ENT_QUOTES);
$q_word      = htmlspecialchars($_GET['q_word'],      ENT_QUOTES);
$field       = htmlspecialchars($_GET['field'],       ENT_QUOTES);
$primary_key = htmlspecialchars($_GET['primary_key'], ENT_QUOTES);


//----------------------------------------------------
//DBへ接続
//----------------------------------------------------
$db = sqlite_open('../SQLite2/test.sqlite','0600');


//----------------------------------------------------
//候補を取得
//----------------------------------------------------
$query = "

	SELECT   $field
	FROM     $db_table
	WHERE    $primary_key = '$q_word'

";
$rows  = sqlite_query($db,$query);

while ($row = sqlite_fetch_array($rows,SQLITE_NUM))
{
	echo $row[0];
}

//----------------------------------------------------
//終了
//----------------------------------------------------
//DBとの通信を切断
sqlite_close($db);

?>